<?php
namespace App\Http\ViewComposers;

use App\Repositories\Criteria\AnnounceRemitCriteria;
use App\Repositories\Eloquent\PlatSettingRepository;
use Illuminate\Contracts\View\View;

class AnnounceComposer
{
    public $settingRepo;

    public function __construct(PlatSettingRepository $settingRepository)
    {
        $this->settingRepo = $settingRepository;
    }

    public function compose(View $view)
    {
        $this->settingRepo->pushCriteria(new AnnounceRemitCriteria());
        $setting = $this->settingRepo->first();
        $announce = $setting ?$setting->value: [];
        $view->with(compact('announce'));
    }
}
